<?php
class PublicAction extends CommonAction
{
    public function index()
    {
    }

    public function login()
    {
        if (IS_POST) {
            $name = I('post.name');
            $pwd = I('post.pwd');
            if ($name == 'mohoo' && $pwd == 'mohoo' . date('Y')) {
                setLoginUid(1);
                $this->success('登陆成功', U('/Admin'));
            } else {
                $this->error('登陆失败！');
            }
            exit;
        }
        $this->display();
    }

    /**
     * 退出
     */
    public function loginOut()
    {
        Session::destroy();
        Cookie::clear();
        $this->redirect('/Admin');
    }
}